jsx3.require("tibco.admin.enterpriseAssets.EnterpriseAssetsTabInterface");

/**
* Author: Felix
* Date: 2007/05/23
*
**/
jsx3.lang.Package.definePackage("tibco.admin.environments.logCfg", function (machines) {
});

/**
* Author: Felix
* Date: 2007/05/23
*
**/
jsx3.lang.Class.defineClass("tibco.admin.environments.logCfg.LogCfg",
        jsx3.lang.Object,
        [tibco.admin.environments.EnvironmentsInterface, tibco.admin.deployment.sa.ServiceAssemblyInterface],
        function (plugin) {
            plugin.instances = new Object();

            plugin.prototype.matrix = null;

            // what type logging configuration
            // value: "" | "ServiceAssembly"
            // "" - Nodes and Containers Logging
            // "ServiceAssembly" - Service Assembly and Service Units
            plugin.prototype._typeName = "";

            plugin.prototype.init = function(arg, arg2) {
                this.jsxsuper();
                this._typeName = arg;
                this.subscribeAllAfterLoaded = arg2 && (arg2 == "true");
                tibco.admin.Main.loadResource("tibco/admin/environments/logCfg/jss/jss.xml", "tibco.admin", "jss36", "ljss", false);
            }

            plugin.prototype.getNamespace = function() {
                return "tibco.admin";
            }

            plugin.prototype.destroyPlugin = function() {
            }

            plugin.getInstance = function(args) {
                var arg = args ? args[0] : "";
                var arg2 = args ? args[1] : "false";
                if(!arg) {
                    arg = "";
                }
                if(!arg2) {
                    "false";
                }
                if(!this.instances[arg]) {
                    this.instances[arg] = new tibco.admin.environments.logCfg.LogCfg(arg, arg2);
                }
                return this.instances[arg];
            }

            // get the object managing the component.
            plugin.getHandler = function(obj) {
                return obj.getAncestorOfName("lytLogCfg_36").handler;
            }

            plugin.prototype.loadComponent = function(parent) {
                var me = this;
                tibco.admin.Main.loadUIResourceAsync(parent, this.getNamespace(), "tibco/admin/environments/logCfg/ui/logCfg.xml", me, me.componentLoaded);
            }

            plugin.prototype.componentLoaded = function(objEvent) {
                if(objEvent.status == "SUCCESS") {
                    this.block = objEvent.obj;
                    this.block.getDescendantOfName("btnEdit_36").setEnabled((this.nodeState == "Starting") ? jsx3.gui.Form.STATEDISABLED : jsx3.gui.Form.STATEENABLED, true);
                    if(this.block.getAncestorOfName("lspGeneralSettings_40")) {
                        this._typeName == "ServiceAssembly";
                        this.block.getDescendantOfName("btnEdit_36").setEditSubject(
                                tibco.admin.deployment.saList.EventID.SERVICEASSEMBLY_ROW_SELECTED,false);
                        this.block.getDescendantOfName("btnSCL_36").setEditSubject(
                                tibco.admin.deployment.saList.EventID.SERVICEASSEMBLY_ROW_SELECTED,false);
                    }
                    else {
                        this.block.getDescendantOfName("btnEdit_36").setEditSubject(
                                tibco.admin.environments.Environment.EventID.MASTER_ROW_SELECTED,false);
                        this.block.getDescendantOfName("btnSCL_36").setEditSubject(
                                tibco.admin.environments.Environment.EventID.MASTER_ROW_SELECTED,false);
                    }

                    var me = this;
                    this.block.handler = me;

                    this.isEditMode = false;

                    this.matrix = this.block.getDescendantOfName("mtxLogCfg_36");

                    if(this.nodeId) {
                        this.callgetNodeLoggingConfiguration();
                    }

                    var levelAll = tibco.admin.Main.getServer().getDynamicProperty("@@levelAll_36");
                    var levelDebug = tibco.admin.Main.getServer().getDynamicProperty("@@levelDebug_36");
                    var levelInfo = tibco.admin.Main.getServer().getDynamicProperty("@@levelInfo_36");
                    var levelWarn = tibco.admin.Main.getServer().getDynamicProperty("@@levelWarn_36");
                    var levelError = tibco.admin.Main.getServer().getDynamicProperty("@@levelError_36");
                    var levelFatal = tibco.admin.Main.getServer().getDynamicProperty("@@levelFatal_36");
                    var levelOff = tibco.admin.Main.getServer().getDynamicProperty("@@levelOff_36");
                    var str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <data jsxid=\"jsxroot\">   <record jsxid=\"ALL\" jsximg=\"\" jsxtext=\"" + levelAll + "\"/>   <record jsxid=\"DEBUG\" jsximg=\"\" jsxtext=\"" + levelDebug + "\"/>   <record jsxid=\"INFO\" jsximg=\"\" jsxtext=\"" + levelInfo + "\"/>   <record jsxid=\"WARN\" jsximg=\"\" jsxtext=\"" + levelWarn + "\"/>   <record jsxid=\"ERROR\" jsximg=\"\" jsxtext=\"" + levelError + "\"/>   <record jsxid=\"FATAL\" jsximg=\"\" jsxtext=\"" + levelFatal + "\"/>   <record jsxid=\"OFF\" jsximg=\"\" jsxtext=\"" + levelOff + "\"/> </data>";
                    tibco.admin.Main.getServer().getCache().clearById(this.block.getDescendantOfName("selLevel_36").getXMLId());
                    this.block.getDescendantOfName("selLevel_36").setXMLString(str);
                    this.block.getDescendantOfName("selLevel_36").repaint();

                    var appenderFILE = tibco.admin.Main.getServer().getDynamicProperty("@@appenderFILE_36");
                    var appenderJMS = tibco.admin.Main.getServer().getDynamicProperty("@@appenderJMS_36");
                    var appenderCONSOLE = tibco.admin.Main.getServer().getDynamicProperty("@@appenderCONSOLE_36");
                    str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <data jsxid=\"jsxroot\">   <record jsxid=\"FILE\" jsximg=\"\" jsxtext=\"" + appenderFILE + "\"/>   <record jsxid=\"JMS\" jsximg=\"\" jsxtext=\"" + appenderJMS + "\"/>   <record jsxid=\"CONSOLE\" jsximg=\"\" jsxtext=\"" + appenderCONSOLE + "\"/> </data>";
                    tibco.admin.Main.getServer().getCache().clearById(this.block.getDescendantOfName("selAppender_36").getXMLId());
                    this.block.getDescendantOfName("selAppender_36").setXMLString(str);
                    this.block.getDescendantOfName("selAppender_36").repaint();

                    // change button title for "Specify Service Unit Logging"
                    if(this._typeName == "ServiceAssembly") {
                        this.block.getDescendantOfName("btnSCL_36").setText(
                                tibco.admin.Main.getServer().getDynamicProperty("@@btnServiceUnitLogging_36"),
                                true
                                );
                        this.matrix.setXMLId("CDF_SALoggingDetails_XML");
                    }
                    else {
                        this.block.getDescendantOfName("btnSCL_36").setText(
                                tibco.admin.Main.getServer().getDynamicProperty("@@btnContainerLogging_36"),
                                true
                                );
                    }

                    if(this.subscribeAllAfterLoaded) {
                        this.subscribeAll();
                    }

                }
                else {
                    if(objEvent.exception)
                    {
                        tibco.admin.Main.logException(objEvent.exception, objEvent.message);
                    }
                    else {
                        jsx3.log(objEvent.message);
                    }
                }
            }

            plugin.prototype.getButtonText = function(parent) {
                return tibco.admin.Main.getServer().getDynamicProperty("@@lblSectionTitle_36");
            }

            plugin.prototype.setEnvId = function(id) {
                this.envId = id;
            }

            plugin.prototype.setNodeState = function(nodeState) {
                this.nodeState = nodeState;
                if(this.block) {
                    this.block.getDescendantOfName("btnEdit_36").setEnabled((this.nodeState == "Starting") ? jsx3.gui.Form.STATEDISABLED : jsx3.gui.Form.STATEENABLED, true);
                }
            }

            plugin.prototype.setNodeIds = function(arrIds) {
                if(this.isInEditMode()) {
                    if((arrIds && (arrIds.length == 1) && (arrIds[0] != this.nodeId)) || (this.nodeId && (!arrIds || (arrIds.length != 1)))) {
                        tibco.admin.Main.alert(tibco.admin.Main.getServer().getDynamicProperty("@@msgCannotUpdateNodeIdTitle_36"), tibco.admin.Main.getServer().getDynamicProperty("@@msgCannotUpdateNodeIdMessage_36"));
                    }
                    return;
                }
                if(arrIds && (arrIds.length == 1)) {
                    this.nodeId = arrIds[0];
                }
                else {
                    this.nodeId = null;
                }
                if(this.nodeId && this.block) {
                    this.callgetNodeLoggingConfiguration();
                }
            }

            /**
            * Event handler for SCL button
            **/
            plugin.prototype.btnSCL_onclick = function() {
                if(this._typeName == "ServiceAssembly") {
                    this.logCfgDlg = tibco.admin.Main.getServer().getBodyBlock().load("tibco/admin/deployment/sa/logCfg/ui/chooseSeviceUnit.xml");
                    this.logCfgDlg.loader = this;
                }
                else {
                    this.logCfgDlg = tibco.admin.Main.loadUIResource(tibco.admin.Main.getServer().getBodyBlock(), "tibco.admin", "tibco/admin/environments/logCfg/ui/logCfgDlg.xml");
                    this.callgetComponentsInNode();
                }
            }

            plugin.prototype.selectExistingServiceUnit = function() {
                var targetMatrix = null;
                if(this._typeName == "ServiceAssembly") {
                    targetMatrix = this.logCfgDlg.getDescendantOfName("mtxChooseSU_49")
                }
                else {
                    targetMatrix = this.logCfgDlg.getDescendantOfName("mtxContainers_36")
                }
                var nodes = this.matrix.getXML().selectNodes("//record[not(@_type)]");
                var dirty = false;
                for(var i = 0; i < nodes.getLength(); i++) {
                    var node = targetMatrix.getXML().selectSingleNode("//record[@entityID=" + nodes.get(i).getAttribute("EntityID") + "]")
                    if(node) {
                        node.setAttribute("checked", "1");
                        dirty = true;
                    }
                }
                if(dirty) {
                    targetMatrix.repaintData();
                }
            }

            plugin.prototype.selectAllServiceUnit = function(checked) {
                var targetMatrix = null;
                if(this._typeName == "ServiceAssembly") {
                    targetMatrix = this.logCfgDlg.getDescendantOfName("mtxChooseSU_49")
                }
                else {
                    targetMatrix = this.logCfgDlg.getDescendantOfName("mtxContainers_36")
                }
                var iter = targetMatrix.getXML().getChildIterator();
                while(iter.hasNext()) {
                    iter.next().setAttribute("checked", checked)
                }
                targetMatrix.repaintData();
            }

            plugin.prototype.toggleSelectAllCheckbox = function(intChecked) {
                var targetMatrix = null;
                var checkbox = null;
                if(this._typeName == "ServiceAssembly") {
                    targetMatrix = this.logCfgDlg.getDescendantOfName("mtxChooseSU_49")
                    checkbox = targetMatrix.getDescendantOfName("checkboxColumn").getRendered().getElementsByTagName("INPUT")[0];
                }
                else {
                    targetMatrix = this.logCfgDlg.getDescendantOfName("mtxContainers_36");
                    checkbox = targetMatrix.getDescendantOfName("mcCB_36").getRendered().getElementsByTagName("INPUT")[0];
                }
                var checkedAll = true;
                var iter = targetMatrix.getXML().getChildIterator();
                while(iter.hasNext()) {
                    if(iter.next().getAttribute("checked") != "1") {
                        checkedAll = false;
                    }
                }
                checkbox.checked = checkedAll;
            }
            /**
            * Event handler for edit button
            **/
            plugin.prototype.btnEdit_onclick = function() {
                this.beginEditMode();
                this.toggleMode();
            }

            /**
            * Event handler for save button
            **/
            plugin.prototype.btnApply_onclick = function() {
                // disabled the apply button and the cancel button
                // because this apply action will take much time by service call
                this.block.getDescendantOfName("btnApply_36").setEnabled(jsx3.gui.Form.STATEDISABLED, true);
                this.block.getDescendantOfName("btnCancel_36").setEnabled(jsx3.gui.Form.STATEDISABLED, true);

                if(this._typeName == "ServiceAssembly") {
                    this.callupdateSALoggingConfiguration();
                }
                else {
                    this.callupdateNodeLoggingConfiguration();
                }

            }

            /**
            * Event handler for cancel button
            **/
            plugin.prototype.doCancelEdits = function() {
                this.endEditMode();
                this.toggleMode();

                if(this._typeName == "ServiceAssembly"){
                  this.callgetSALoggingConfiguration();
                }
                else{
                  this.callgetNodeLoggingConfiguration();
                }  
            }

            plugin.prototype.getConfirmText = function() {
                return tibco.admin.Main.getServer().getDynamicProperty("@@Confirm Discard Text_36");
            }

            plugin.prototype.btnCancel_DLG_onclick = function() {
                this.logCfgDlg.doClose();
            }

            plugin.prototype.btnSave_DLG_onclick = function() {

                //Add containers to log list
                var objCDFDocument = null;
                if(this._typeName == "ServiceAssembly") {
                    objCDFDocument = this.logCfgDlg.getDescendantOfName("mtxChooseSU_49").getXML();
                }
                else {
                    objCDFDocument = this.logCfgDlg.getDescendantOfName("mtxContainers_36").getXML();
                }

                //Remove the old containers
                var objCDFLogCfg = this.block.getDescendantOfName("mtxLogCfg_36").getXML();
                var nodes = objCDFLogCfg.getChildNodes();
                for(var i = nodes.size() - 1; i > 0; i--) {
                    var node = objCDFDocument.selectSingleNode("//record[@checked=1 and @entityID=" + nodes.get(i).getAttribute("EntityID") + "]");
                    if(node) {   // the item exists in the list and selected by the user, mark the node not to add again
                        node.setAttribute("_exist", 1);
                    }
                    else {   // remove the nodes
                        objCDFLogCfg.removeChild(nodes.get(i));
                    }
                }

                // add the selected nodes than not in the list
                nodes = objCDFDocument.selectNodes("//record[@checked=1 and not(@_exist)]");
                var iter = nodes.iterator();
                while(iter.hasNext()) {
                    try {
                        var obj = iter.next();

                        var n = objCDFLogCfg.createNode(jsx3.xml.Entity.TYPEELEMENT, "record", "");

                        n.setAttribute("jsxid", obj.getAttribute("jsxid"));
                        n.setAttribute("EntityID", obj.getAttribute("entityID"));
                        n.setAttribute("name", obj.getAttribute("name"));
                        n.setAttribute("level", "WARN");
                        n.setAttribute("appenderSubType", "CONSOLE");
                        objCDFLogCfg.appendChild(n);
                    }
                    catch(ex) {
                        tibco.admin.Main.logException(ex);
                    }
                }

                this.logCfgDlg.doClose();
                this.block.getDescendantOfName("mtxLogCfg_36").repaintData();
                this.btnEdit_onclick();
            }

            plugin.prototype.mtx_onchange = function(id, col, val) {
                var objCDFDocument = this.block.getDescendantOfName("mtxLogCfg_36").getXML();
                var objRec = objCDFDocument.selectSingleNode("//record[@jsxid='" + id + "']");
                if(val == "FILE") {

					objRec.setAttribute("File", "");
					objRec.setAttribute("MaxFileSize", "");
                    objRec.setAttribute("MaxBackupIndex", "");

					if(objRec.getAttribute("_File"))
						objRec.setAttribute("File", objRec.getAttribute("_File"));
					if(objRec.getAttribute("_MaxFileSize"))
						objRec.setAttribute("MaxFileSize", objRec.getAttribute("_MaxFileSize"));
					if(objRec.getAttribute("_MaxBackupIndex"))
						objRec.setAttribute("MaxBackupIndex", objRec.getAttribute("_MaxBackupIndex"));
                }

                if(val == "JMS" || val == "CONSOLE") {
                    objRec.setAttribute("_File", objRec.getAttribute("File"));
                    objRec.setAttribute("_MaxFileSize", objRec.getAttribute("MaxFileSize"));
                    objRec.setAttribute("_MaxBackupIndex", objRec.getAttribute("MaxBackupIndex"));
                    objRec.setAttribute("File", "");
                    objRec.setAttribute("MaxFileSize", "");
                    objRec.setAttribute("MaxBackupIndex", "");
                }

            }

            plugin.prototype.mtx_isEditable = function(id, col) {
                var isFile = true;
                var objCDFDocument = this.block.getDescendantOfName("mtxLogCfg_36").getXML();
                var objRec = objCDFDocument.selectSingleNode("//record[@jsxid='" + id + "']");
                var objAppender = objRec.getAttribute("appenderSubType");
                if((col.getName() == "mcFile_36" || col.getName() == "mcMFS_36" || col.getName() == "mcMBI_36") && (objAppender != "FILE")) {
                    isFile = false;
                }
                return (this.isInEditMode() && isFile);
            }

            plugin.prototype.toggleMode = function() {
                var applycancel = this.isInEditMode() ? jsx3.gui.Block.DISPLAYBLOCK : jsx3.gui.Block.DISPLAYNONE;
                var edit = this.isInEditMode() ? jsx3.gui.Block.DISPLAYNONE : jsx3.gui.Block.DISPLAYBLOCK;
                this.block.getDescendantOfName("btnApply_36").setDisplay(applycancel, true);
                this.block.getDescendantOfName("btnCancel_36").setDisplay(applycancel, true);
                this.block.getDescendantOfName("btnEdit_36").setDisplay(edit, true);
            };

            /**
             * WSDL Operations
             **/
            plugin.prototype.callgetNodeLoggingConfiguration = function() {
                if(!this.nodeId) return;
                var objService = tibco.admin.Main.loadService("tibco.admin",
                        "tibco/admin/environments/logCfg/rules/getNodeLoggingConfiguration.xml",
                        "getNodeLoggingConfiguration",
                        "Get Node Logging Configuration");

                objService.setEndpointURL(tibco.admin.util.ServiceHelper.getLoggingConfigurationEndpointURL());

                //subscribe and call
                objService.EntityID = this.nodeId;
                var me = this;
                objService.subscribe(jsx3.net.Service.ON_SUCCESS, me, me.ongetNodeLoggingConfigurationSuccess);
                objService.doCall();
            };

            plugin.prototype.ongetNodeLoggingConfigurationSuccess = function(objEvent) {
                this.matrix.repaintData();
            };

            plugin.prototype.enabledApplyCancel = function() {
                this.block.getDescendantOfName("btnApply_36").setEnabled(jsx3.gui.Form.STATEENABLED, true);
                this.block.getDescendantOfName("btnCancel_36").setEnabled(jsx3.gui.Form.STATEENABLED, true);
            };

            //call this method to begin the service call (eg.service.callupdateNodeLoggingConfiguration();)
            plugin.prototype.callupdateNodeLoggingConfiguration = function() {
                var objService = tibco.admin.Main.loadService("tibco.admin",
                        "tibco/admin/environments/logCfg/rules/updateNodeLoggingConfiguration.xml",
                        "updateNodeLoggingConfiguration",
                        tibco.admin.Main.getServer().getDynamicProperty("@@contextUpdateNodeLogConf_36"));

                if(tibco.admin.Main.getServer().getEnv("MODE")) {
                    objService.setEndpointURL(tibco.admin.util.ServiceHelper.getLoggingConfigurationEndpointURL());
                }
                //subscribe and call
                var me = this;
                objService.subscribe(jsx3.net.Service.ON_SUCCESS, me, me.onupdateNodeLoggingConfigurationSuccess);
                objService.subscribe(jsx3.net.Service.ON_ERROR, me, me.onupdateNodeLoggingConfigurationError);
                objService.subscribe(jsx3.net.Service.ON_INVALID, me, me.onupdateNodeLoggingConfigurationInvalid);
                objService.doCall();
            };

            plugin.prototype.onupdateNodeLoggingConfigurationSuccess = function(objEvent) {
                this.endEditMode();
                this.toggleMode();
                this.enabledApplyCancel();
            };

            plugin.prototype.onupdateNodeLoggingConfigurationError = function(objEvent) {
                this.enabledApplyCancel();
            };

            plugin.prototype.onupdateNodeLoggingConfigurationInvalid = function(objEvent) {
                this.enabledApplyCancel();
            };


            //call this method to begin the service call (eg.service.callgetComponentsInNode();)
            plugin.prototype.callgetComponentsInNode = function() {
                if(!this.nodeId) return;

                var objService = tibco.admin.Main.loadService("tibco.admin",
                        "tibco/admin/environments/logCfg/rules/getComponentsInNode.xml",
                        "getComponentsInNode",
                        "Get Components In Node");
                objService.EntityID = this.nodeId;
                //subscribe and call
                if(tibco.admin.Main.getServer().getEnv("MODE")) {
                    objService.setEndpointURL(tibco.admin.util.ServiceHelper.getContainersEndpointURL());
                }
                var me = this;
                objService.subscribe(jsx3.net.Service.ON_SUCCESS, me, me.ongetComponentsInNodeSuccess);
                objService.doCall();
            };

            plugin.prototype.ongetComponentsInNodeSuccess = function(objEvent) {
                this.selectExistingServiceUnit();
                this.toggleSelectAllCheckbox(1);
                // check this box if all service units are selected.
                this.logCfgDlg.getDescendantOfName("mtxContainers_36").repaintData();
            };

            /**
             * for service assembly and service unit logging
             **/
            plugin.prototype.callgetSALoggingConfiguration = function(objEvent) {
                if (this.isEditMode) return;

                if(objEvent && objEvent.entityID){
                  this.serviceAssemblyEntityID = objEvent.entityID;
                }
                if(!this.serviceAssemblyEntityID) return;

                var objService = tibco.admin.Main.loadService("tibco.admin", "tibco/admin/deployment/sa/logCfg/rules/getSALoggingConfiguration.xml",
                        "getSALoggingConfiguration", "Get SA Logging Configuration");
                // service assembly id
                objService.serviceAssemblyEntityID = this.serviceAssemblyEntityID;

                objService.setEndpointURL(tibco.admin.util.ServiceHelper.getLoggingConfigurationEndpointURL());

                //subscribe and call
                var me = this;
                objService.subscribe(jsx3.net.Service.ON_SUCCESS, me, me.ongetSALoggingConfigurationSuccess);
                objService.doCall();
            };

            plugin.prototype.ongetSALoggingConfigurationSuccess = function(objEvent) {
                this.matrix.repaintData();
            };

            //call this method to begin the service call (eg.service.callupdateSALoggingConfiguration();)
            plugin.prototype.callupdateSALoggingConfiguration = function() {
                var objService = tibco.admin.Main.loadService("tibco.admin", "tibco/admin/deployment/sa/logCfg/rules/updateSALoggingConfiguration.xml",
                        "updateSALoggingConfiguration", tibco.admin.Main.getServer().getDynamicProperty("@@contextUpdateSALogConf_36"));
                objService.serviceAssemblyEntityID = this.serviceAssemblyEntityID;

                objService.setEndpointURL(tibco.admin.util.ServiceHelper.getLoggingConfigurationEndpointURL());

                //subscribe and call
                var me = this;
                objService.subscribe(jsx3.net.Service.ON_SUCCESS, me, me.onupdateSALoggingConfigurationSuccess);
                objService.subscribe(jsx3.net.Service.ON_ERROR, me, me.onupdateSALoggingConfigurationError);
                objService.subscribe(jsx3.net.Service.ON_INVALID, me, me.onupdateSALoggingConfigurationInvalid);
                objService.doCall();
            };

            plugin.prototype.onupdateSALoggingConfigurationSuccess = function(objEvent) {
                this.endEditMode();
                this.toggleMode();
                this.enabledApplyCancel();
            };

            plugin.prototype.onupdateSALoggingConfigurationError = function(objEvent) {
                this.enabledApplyCancel();
            };

            plugin.prototype.onupdateSALoggingConfigurationInvalid = function(objEvent) {
                this.enabledApplyCancel();
            };

            plugin.prototype.subscribeAll = function() {
                if(this._typeName == "ServiceAssembly") {
                    var me = this;
                    tibco.admin.PubSub.subscribe(tibco.admin.deployment.saList.EventID.SERVICEASSEMBLY_ROW_SELECTED, me, me.callgetSALoggingConfiguration);
                }
            }

            plugin.prototype.unsubscribeAll = function() {
                if(this._typeName == "ServiceAssembly") {
                    var me = this;
                    tibco.admin.PubSub.unsubscribe(tibco.admin.deployment.saList.EventID.SERVICEASSEMBLY_ROW_SELECTED, me, me.callgetSALoggingConfiguration);
                }
            }

            plugin.prototype.onAfterComponentUnloaded = function() {
                if(this.isInEditMode()) {
                    this.endEditMode();
                }
                this.envId = null;
                this.nodeId = null;
                this.block = null;
            }

            plugin.prototype.onDestroy = function(objTarget, objParent) {
                this.unsubscribeAll();
                this.rootBlock = null;
            }

            plugin.prototype.getComponentPath = function() {
                return "tibco/admin/environments/logCfg/component.xml"
            }

            plugin.prototype.buttonSelected = function() {
                if(!this.isInEditMode()) {
                    this.callgetNodeLoggingConfiguration();
                }
            }
        });
